package com.blockmeta.bbs.immodule.bean.sort;

import android.text.TextUtils;

import com.blockmeta.bbs.immodule.bean.beaninterface.IFriendsEntry;
import com.blockmeta.bbs.immodule.utils.IMUtils;

import java.util.Comparator;

/**
 * @author AirThor
 * @date 2019/4/9.
 */
public class GradeComparator implements Comparator<IFriendsEntry>{
    private boolean ascendingOrder;


    public GradeComparator(boolean ascendingOrder) {
        this.ascendingOrder = ascendingOrder;
    }

    @Override
    public int compare(IFriendsEntry o1, IFriendsEntry o2) {
        int grade1 = o1.getGrade();
        int grade2 = o2.getGrade();
        if (ascendingOrder){
            //等级升序排列
            return IMUtils.UserLevel.compareLevel(grade1, grade2);
        }else {
            return IMUtils.UserLevel.compareLevel(grade2, grade1);
        }
    }
}
